package com.qijian.maindata.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qijian.maindata.domain.BomDetail;
import com.qijian.maindata.domain.query.BomDetailInfoQuery;
import com.qijian.maindata.domain.query.BomDetailQuery;
import com.qijian.maindata.domain.vo.BomDetailAllVo;
import com.qijian.maindata.domain.vo.BomDetailInfoVo;
import com.qijian.maindata.domain.vo.BomDetailVo;
import com.qijian.tool.domain.Storage;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * BOM明细Service接口
 *
 * @author qijian
 * @date 2021-09-01
 */
public interface IBomDetailService extends IService<BomDetail> {

    /**
     * 艺管理-员工收益 钻取Bom和数控件详情
     * @param query
     * @return
     */
    List<BomDetailVo> selectVo(BomDetailQuery query);
    List<BomDetailVo> selectVo(QueryWrapper<BomDetailQuery> queryWrapper, Integer type);

    List<BomDetailVo> selectBomAndLineVo(QueryWrapper<BomDetailQuery> queryWrapper);

    List<BomDetailAllVo> selectAllVo(QueryWrapper<BomDetailQuery> queryWrapper);

    /**
     * collection导致无法正常分页
     * 正常分页可以参考 {@link #selectBomInfo(Page, QueryWrapper)}
     */
    @Deprecated
    Page<BomDetailVo> pageVo(Page<BomDetail> page, QueryWrapper<BomDetailQuery> queryWrapper);

    List<BomDetailVo> listVo(QueryWrapper<BomDetailQuery> queryWrapper);

    List<BomDetailVo> selectNc(Long bomId);

    Page<BomDetailInfoVo> selectBomInfo(Page<BomDetailInfoVo> page, QueryWrapper<BomDetailInfoQuery> queryWrapper);

    List<Storage> getFiles(Long bomId);

    void calProcessTime(List<BomDetailVo> details, Date time, Map<String, LocalDateTime> workTimeMap, Map<String, Long> workMinute, boolean frontOrBack);

    Map<String, Map<String, Long>> getSaleCapacity(Map<String, Double> workTypeWorkTime, Integer dataMonths);

    void recoveryBom(Long itemId);

    List<BomDetailVo> getHisLineByBomId(Long bomId);

    BomDetailVo getBomDetailLineProcess(Long bomDetailId);

    BomDetailVo getBomDetailLineProcessType(Long bomId);
}
